//
//  ZHUSearchTextField.m
//  proucrement
//
//  Created by zhu on 2017/12/12.
//  Copyright © 2017年 zhu. All rights reserved.
//

#import "baseSearchTextField.h"

@implementation baseSearchTextField

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self setup];
    }
    return self;
}

- (void)setup
{
    [self setupLeftView];// 设置左边 icon
    [self setupLayer];// 设置样式
}

// 设置leftView
- (void)setupLeftView
{
    // search textField
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    
    UIImageView *leftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"search_icon"]];
    leftImageView.frame = CGRectMake(10, 7, 16, 16);
    [leftView addSubview:leftImageView];
    self.leftView = leftView;
    self.leftViewMode = UITextFieldViewModeAlways;
}

- (void)setupLayer
{
    self.layer.cornerRadius = 15;
    
}

@end
